home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / fmdrgdrp / opt2 / invent.exe / CUST.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-08-20  |  4.9 KB  |  146 lines

  1. VERSION 2.00
  2. Begin Form CustForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Customer"
  5.    ClientHeight    =   2610
  6.    ClientLeft      =   3240
  7.    ClientTop       =   1830
  8.    ClientWidth     =   4635
  9.    Height          =   3015
  10.    HelpContextID   =   102
  11.    Icon            =   CUST.FRX:0000
  12.    Left            =   3180
  13.    LinkTopic       =   "Form2"
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   2610
  16.    ScaleWidth      =   4635
  17.    Top             =   1485
  18.    Width           =   4755
  19.    Begin TgDemo CustTable 
  20.       BackColor       =   &H00C0C0C0&
  21.       BorderStyle     =   0  'None
  22.       Configurable    =   -1  'True
  23.       DataSource      =   "Data1"
  24.       Editable        =   -1  'True
  25.       EditBackColor   =   &H8000000D&
  26.       EditForeColor   =   &H8000000E&
  27.       FetchMode       =   0  'By cell
  28.       FontBold        =   0   'False
  29.       FontItalic      =   0   'False
  30.       FontName        =   "MS Sans Serif"
  31.       FontSize        =   8.25
  32.       FontStrikethru  =   0   'False
  33.       FontUnderline   =   0   'False
  34.       HeadBackColor   =   &H80000002&
  35.       HeadForeColor   =   &H80000009&
  36.       Headings        =   -1  'True
  37.       Height          =   1935
  38.       HorzColor       =   &H00808080&
  39.       HorzLines       =   2  '3D
  40.       InactiveBackColor=   &H00808080&
  41.       InactiveForeColor=   &H00000000&
  42.       Layout          =   CUST.FRX:0302
  43.       Left            =   0
  44.       MarqueeStyle    =   1  'Solid Cell Border
  45.       SelectedBackColor=   &H00000000&
  46.       SelectedForeColor=   &H00FFFFFF&
  47.       SelectMode      =   0  'Disabled
  48.       TabIndex        =   0
  49.       Top             =   0
  50.       UseBookmarks    =   -1  'True
  51.       VertColor       =   &H00808080&
  52.       VertLines       =   2  '3D
  53.       Width           =   3735
  54.    End
  55.    Begin Data Data1 
  56.       Caption         =   "Data1"
  57.       Connect         =   ""
  58.       DatabaseName    =   ""
  59.       Exclusive       =   0   'False
  60.       Height          =   270
  61.       Left            =   360
  62.       Options         =   0
  63.       ReadOnly        =   0   'False
  64.       RecordSource    =   ""
  65.       Top             =   2040
  66.       Visible         =   0   'False
  67.       Width           =   1215
  68.    End
  69. ' Local definitions for customer form
  70. Dim ourset As Dynaset
  71. Dim FormIndex As Integer
  72. Dim WidthDelta As Integer
  73. Sub CustTable_Append ()
  74.     ' Append a new customer record.  Add 1 to the last
  75.     ' record and move to it.
  76.     newcust& = 1000
  77.     If ourset.RecordCount > 0 Then
  78.         ourset.MoveLast
  79.         newcust& = ourset("CustNo") + 1
  80.     End If
  81.     ourset.AddNew
  82.     ourset("CustName") = "New..."
  83.     ourset("CustNo") = newcust&
  84.     ourset.Update
  85.     ourset.MoveLast
  86. End Sub
  87. Sub CustTable_GotFocus ()
  88.     ' Display status line help
  89.     SetStatus "Customers - DownArrow for new; drag to order file to create orders"
  90. End Sub
  91. Sub CustTable_KeyPress (KeyAscii As Integer)
  92.     ' Escape discards changes
  93.     If KeyAscii = 27 Then Data1.UpdateControls
  94. End Sub
  95. Sub CustTable_KeyUp (KeyCode As Integer, Shift As Integer)
  96.     ' F2 commits changes in the current record
  97.     If KeyCode = KEY_F2 Then Data1.Recordset.Update
  98. End Sub
  99. Sub CustTable_LostFocus ()
  100.     ' Update record data when switching to another form
  101.     Data1.Recordset.Update
  102. End Sub
  103. Sub CustTable_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  104.     GridMaybeDrag CustTable, X, Y
  105. End Sub
  106. Sub CustTable_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  107.     GridTestDrag CustTable, Button, X, Y, MASK_CUST, Utils.DragRow
  108. End Sub
  109. Sub Form_Load ()
  110.     ' Remember the difference between the inside and
  111.     ' outside dimensions.
  112.     WidthDelta = Me.Width - Me.ScaleWidth
  113.     ' Capture information about the database we are opening.
  114.     ' This information was prepared by the CustOpen routine
  115.     ' in CUST.BAS
  116.     FormIndex = FormLastAlloc()
  117.     Me.Tag = FormIndex
  118.     Data1.DatabaseName = CustFormItems(FormIndex).fiFileName
  119.     Data1.RecordSource = CustFormItems(FormIndex).fiTable
  120.     Data1.Refresh
  121.     Set ourset = Data1.Recordset
  122.     ' Our tag is used to notify drop destinations of
  123.     ' which customer form instance we are.
  124.     CustTable.Tag = FormIndex
  125. End Sub
  126. Sub Form_Resize ()
  127.     ' The first time we resize (when we're opened),
  128.     ' constrain our width.  Thereafter, allow the width
  129.     ' to be changed at the user's discretion.
  130.     If WidthDelta Then
  131.         If Me.WindowState = NORMAL Then
  132.             Me.Width = CustTable.Width + WidthDelta
  133.             CustTable.Height = Me.ScaleHeight
  134.             WidthDelta = 0
  135.             Exit Sub
  136.         End If
  137.     End If
  138.     CustTable.Width = Me.ScaleWidth
  139.     CustTable.Height = Me.ScaleHeight
  140. End Sub
  141. Sub Form_Unload (Cancel As Integer)
  142.     ' Close the recordset and deallocate the form
  143.     Data1.Recordset.Close
  144.     FormFree CustFormItems(FormIndex)
  145. End Sub
  146.